package com.lalilu.homework4;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.lalilu.homework4.utils.StatusBarUtil;


public class RegistryInfoShow extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarUtil.setStatusBarColor(this);
        setContentView(R.layout.activity_registry_info_show);

        TextView username = findViewById(R.id.text_username);
        TextView checkcode = findViewById(R.id.text_checkcode);
        TextView password = findViewById(R.id.text_password);

        Button buttonGallery = findViewById(R.id.button_browser);
        Button buttonBilibili = findViewById(R.id.button_bilibili);
        Button buttonWechat = findViewById(R.id.button_wechat);

        Bundle bundle = getIntent().getExtras();
        username.setText(new StringBuilder().append("username: ").append(bundle.get("com.lalilu.homework4.username").toString()).toString());
        checkcode.setText(new StringBuilder().append("checkcode: ").append(bundle.get("com.lalilu.homework4.checkcode").toString()).toString());
        password.setText(new StringBuilder().append("password: ").append(bundle.get("com.lalilu.homework4.password").toString()).toString());

        buttonGallery.setOnClickListener((view) -> {
            Intent intent = new Intent();
            intent.setAction("android.intent.action.VIEW");
            intent.setData(Uri.parse("https://baidu.com"));
            startActivity(intent);
        });

        buttonBilibili.setOnClickListener((view) -> {
            Intent intent = getPackageManager().getLaunchIntentForPackage("tv.danmaku.bili");
            startActivity(intent);
        });

        buttonWechat.setOnClickListener((view) -> {
            Intent intent = getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
            startActivity(intent);
        });
    }
}